<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div{
            width: 100px;
            height: 100px;
            background:red;
            margin-bottom:10px;
        }
    </style>
    <script src="jquery-3.2.0.min.js"></script>
    <script>
        $(function(){
            $('div:contains(a)').click(
                    function(){
                        alert(1)
                    }
            )
        });
    </script>
</head>
<body>
<div>bbbbb</div>
<div>aaaaa</div>
<div>ccccc</div>
</body>
</html>